package Day13.Tests;

import javax.swing.*;
import java.awt.*;

public class DouDiZhuLable extends JFrame {
    private DouDiZhu ddz = new DouDiZhu();
    private ImageIcon playerIcon1 = new ImageIcon("123.jpg");
    private ImageIcon playerIcon2 = new ImageIcon("123.jpg");
    private ImageIcon playerIcon3 = new ImageIcon("123.jpg");
    public DouDiZhuLable(DouDiZhu ddz){
        JLabel label1 = new JLabel(playerIcon1);
        JLabel label2 = new JLabel(playerIcon2);
        JLabel label3 = new JLabel(playerIcon3);

        label1.setBounds(20,400,100,100);
        label2.setBounds(900,900,100,100);
        label3.setBounds(1780,400,100,100);

        for (int i = 0; i < 17;i ++){

            int num = ((ddz.ary.get(i).getNum()/4) + 3) ;
            int num2 =(ddz.ary.get(i).getTypeValue()) ;
            if (num == 5){
                System.out.println(ddz.ary.get(i));
            }

            JLabel jLabel = new JLabel(new ImageIcon("Image\\" + num + "_" + num2 + ".jpg"));
//            System.out.println("Image\\" + num + "_" + num2 + ".jpg");
            jLabel.setBounds(130,520-(i * 30),105,150);
            this.add(jLabel);
        }

        for (int i = 17; i < 34;i ++){
            int num = (ddz.ary.get(i).getNum());
            int num2 = 5 - (ddz.ary.get(i).getNum());
            JLabel jLabel = new JLabel(new ImageIcon("Image\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(950,1030-(i * 30),105,150);
            this.add(jLabel);
        }

        for (int i = 34; i < 51;i ++){
            int num = (ddz.ary.get(i).getNum());
            int num2 = 5 -(ddz.ary.get(i).getNum());
            JLabel jLabel = new JLabel(new ImageIcon("Image\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(780 - ((i-34) * 30),500,105,150);
            this.add(jLabel);
        }
        for (int i = 51; i < 54;i ++){
            int num = (ddz.ary.get(i).getNum());
            int num2 = 5 -(ddz.ary.get(i).getNum());
            JLabel jLabel = new JLabel(new ImageIcon("Image\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(570 - ((i-51) * 30),100,105,150);
            this.add(jLabel);
        }
        this.setLayout(null);
        JButton button = new JButton("开始");
        button.setBounds(855,435,150,50);
        this.add(button);
        this.add(label1);
        this.add(label2);
        this.add(label3);
        this.setSize(1920,1080);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }

    public void cardList(int start, int end) {
        for (int i = start; i < end; i++) {
            int num = (ddz.ary.get(i).getNum()) ;
            int num2 = (ddz.ary.get(i).getNum()) ;
            JLabel jLabel = new JLabel(new ImageIcon("image\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(130, 520 - (i * 30), 105, 150);
            this.add(jLabel);
        }

    }
}
